﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TimeSheet.UI
{
    public partial class MainPage : UserControl
    {
        private Data.Factory _factory = new Data.Factory();

        public MainPage()
        {
            InitializeComponent();

            weekControl1.Projects.Add(new Views.WeekProjectView() { Project = "Un", Monday = "1:00", Tuesday = "2:00", Wednesday = "3:00", Thursday="4:00", Friday="5:00", Saturday="6:00", Sunday="7:00", Width=300 });
            weekControl1.Projects.Add(new Views.WeekProjectView() { Project = "Deux", Monday = "2:00", Width = 300 });
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            TimeSheetData.TimeSheetDataClient svc = new TimeSheetData.TimeSheetDataClient();
            svc.GetDateCompleted += new EventHandler<TimeSheetData.GetDateCompletedEventArgs>(svc_GetDateCompleted);
            svc.GetDateAsync();
        }

        void svc_GetDateCompleted(object sender, TimeSheetData.GetDateCompletedEventArgs e)
        {
            MessageBox.Show("Hello " + e.Result.ToString());
        }

        private void btnConfiguration_Click(object sender, RoutedEventArgs e)
        {
            ProjectsWindow frmProjects = new ProjectsWindow(_factory);
            frmProjects.Show();
        }

        private void calendar1_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
        {
            weekControl1.WeekDate = calendar1.SelectedDate.Value;
        }
        
    }
}
